package com.yingxin.yxerp.module.common;

import org.apache.commons.lang3.StringUtils;

import java.util.HashMap;
import java.util.Map;

public class CompanyHelper {

    private static final Map<String, String> map = new HashMap<>();

    private static final Map<String, String> map1 = new HashMap<>();

    private static final Map<String, String> map2 = new HashMap<>();

    public static void add1(String key, String value) {
        map1.put(key, value);
    }

    public static void add2(String key, String value) {
        map2.put(key, value);
    }

    public static void init() {
        if (map.size() == 0) {
            for (CompanyEnum type : CompanyEnum.values()) {
                map.put(type.getId(), type.getFullName());
            }
        }
    }
    public static String getFullName(String key) {
        init();
        String fullName1 = map1.get(key);
        String fullName2 = map2.get(key);
        String fullName3 = map.get(key);
        if (StringUtils.isNotEmpty(fullName1)){
            return fullName1;
        }else if (StringUtils.isNotEmpty(fullName2)){
            return fullName2;
        }else if (StringUtils.isNotEmpty(fullName3)){
            return fullName3;
        }else {
            return "";
        }
    }
}